//
//  HYPickPhotoViewController.m
//  HaiYue
//
//  Created by tucici on 2019/3/25.
//  Copyright © 2019 skyline. All rights reserved.
//

#import "HYPickPhotoViewController.h"
NSString * const CCNoticeNameHYPickPhoto = @"CCNoticeNameHYPickPhoto";

@interface HYPickPhotoViewController ()<UINavigationControllerDelegate,UIImagePickerControllerDelegate>

@end

@implementation HYPickPhotoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.delegate = self;
    self.allowsEditing = YES;
    // Do any additional setup after loading the view.
}
//选择完成回调函数
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info
{
    //获取图片
    UIImage *image = info[UIImagePickerControllerEditedImage];
    if (image)
        [CCNotice post:CCNoticeNameHYPickPhoto obj:nil info:@{@"image":image}];
    else
        [CCAlert showMessage:@"未选择图片" hidden:nil];
    [self dismissViewControllerAnimated:YES completion:nil];
}

//用户取消选择
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
    [self dismissViewControllerAnimated:YES completion:nil];
}
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}
/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
